#include <iostream>
#include <vector>
#include <math.h>
#include <unordered_map>

using namespace std;

// Q1. 检查元素频次是否为质数
// https://leetcode.cn/contest/weekly-contest-455/problems/check-if-any-element-has-prime-frequency/description/

class Solution
{
public:
    bool isPrime1(int num)
    {
        if (num == 1)
            return false;
        if (num == 2)
        {
            return true;
        }
        for (int i = 2; i < sqrt(num) + 1; i++)
        {
            if(num % i == 0){
                return false;
            }
        }
        return true;
    }
    bool isPrime(int num) {
    if (num <= 1) return false;
    if (num == 2) return true;
    if (num % 2 == 0) return false; // 优化：排除偶数

    for (int i = 3; i * i <= num; i += 2) {
        if (num % i == 0) return false;
    }
    return true;
}

    bool checkPrimeFrequency(vector<int> &nums)
    {
        unordered_map<int, int> cntNum;
        for (int i = 0; i < nums.size(); i++){
            cntNum[nums[i]]++;
        }
        for(auto it : cntNum){
            if(!isPrime(it.second)){
                return true;
            }
        }
        return false;
    }
};

int main()
{
    return 0;
}